var prod = process.env.NODE_ENV === 'production'

module.exports = {
    output: 'dist',
    source: 'src',
    wpyExt: '.wpy',
    eslint: true,
    compilers: {
        less: {
            compress: true
        },
        /*sass: {
          outputStyle: 'compressed'
        },*/
        babel: {
            sourceMap: true,
            presets: [
                'es2015',
                'stage-1'
            ],
            plugins: [
                'transform-decorators-legacy',
                'transform-export-extensions',
                'syntax-export-extensions'
            ]
        }
    },
    plugins: {}
}

if (prod) {

    delete module.exports.compilers.babel.sourcesMap;
    // 压缩sass
    // module.exports.compilers['sass'] = {outputStyle: 'compressed'}

    // 压缩less
    module.exports.compilers['less'] = { compress: true }

    // 压缩js
    module.exports.plugins = {
        uglifyjs: {
            filter: /\.js$/,
            config: {}
        },
        imagemin: {
            filter: /\.(jpg|png|jpeg)$/,
            config: {
                jpg: {
                    quality: 80
                },
                png: {
                    quality: 80
                }
            }
        }
    }
}